package netty.InAndOutBundHandler.server;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

/**
 * @ClassName MyServerHandler
 * @Description TODO
 * @Author director吴
 * @Date 2022/4/21 13:22
 * @Version 1.0
 **/
public class MyServerHandler extends SimpleChannelInboundHandler<Long> {

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, Long aLong) throws Exception {

        System.out.println("从客户端["+ctx.channel().remoteAddress()+"]读取的信息:"+aLong);

    }


    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
        cause.printStackTrace();
        ctx.close();
    }
}
